@extends('admin.app')

@section('content')
  <div class="panel panel-default">
    <div class="panel-heading font-bold">
      融资基本信息
    </div>
    <div class="panel-body">
      <form class="form-horizontal form-validation add" enctype="multipart/form-data" action="{{ admin_action('Business\DemandController@store') }}" method="post">
        {{ csrf_field() }}
        <input type="hidden" name="project_type_template_id" value="{{$type->id}}"/>
        <div class="form-group">
          <div class="col-sm-2 control-label">融资人*</div>
          <div class="col-sm-10">
            <input type="text" class="form-control" name="financier_uname" value="panliang" data-rule-required="true" data-url="{{ admin_action('Business\DemandController@getUserInfo') }}"/>
            <span class="help-block m-b-none">填写用户名或者电话号码</span>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">融资人真实姓名*</div>
          <div class="col-sm-10">
            <input type="hidden" name="financier_id" data-rule-required="true"/>
            <input type="text" class="form-control" name="financier_name" data-rule-required="true" readonly/>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">融资标题*</div>
          <div class="col-sm-10">
            <input type="text" class="form-control" name="projects_name" value="融资" data-rule-required="true"/>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">融资金额*</div>
          <div class="col-sm-10">
            <input type="text" class="form-control" name="finance_money" value="2000" data-rule-required="true" data-rule-number="true"/>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">是否新手标</div>
          <div class="col-sm-10" onselectstart="return false;">
            <label class="checkbox-inline i-checks"><input type="radio" name="new_projects" value="1"/><i></i>是</label>
            <label class="checkbox-inline i-checks"><input type="radio" name="new_projects" value="0" checked/><i></i>否</label>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">是否自动发布公告</div>
          <div class="col-sm-10" onselectstart="return false;">
            <label class="checkbox-inline i-checks"><input type="radio" name="is_notice" value="1" data-disabled="[name='notice_id'],[name='notice_time']"/><i></i>是</label>
            <label class="checkbox-inline i-checks"><input type="radio" name="is_notice" value="0" data-disabled="[name='notice_id'],[name='notice_time']" checked/><i></i>否</label>
            <p class="form-control-static">会在项目发布时自动生成一条公告信息</p>
          </div>
        </div>
        <div class="form-group">
          <div class="col-sm-10 col-sm-offset-2">
            <select name="notice_id" class="form-control" data-rule-required="true" disabled>
              @foreach($notices as $item)
              <option value="{{$item->id}}">{{$item->title}}</option>
              @endforeach
            </select>
          </div>
        </div>
        <div class="form-group">
          <div class="col-sm-2 control-label">发布公告的时间</div>
          <div class="col-sm-10">
            <input type="text" name="notice_time" class="form-control datetimepicker" disabled/>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">是否参加风险备付金计划</div>
          <div class="col-sm-10" onselectstart="return false;">
            <label class="checkbox-inline i-checks"><input type="radio" name="is_plan" value="1" /><i></i>是</label>
            <label class="checkbox-inline i-checks"><input type="radio" name="is_plan" value="0" checked/><i></i>否</label>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">是否使用红包</div>
          <div class="col-sm-10" onselectstart="return false;">
            <label class="checkbox-inline i-checks"><input type="radio" name="gift_check" value="1"/><i></i>是</label>
            <label class="checkbox-inline i-checks"><input type="radio" name="gift_check" value="0" checked/><i></i>否</label>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">是否累计使用红包</div>
          <div class="col-sm-10" onselectstart="return false;">
            <label class="checkbox-inline i-checks"><input type="radio" name="gift_money_auto" value="1"/><i></i>是</label>
            <label class="checkbox-inline i-checks"><input type="radio" name="gift_money_auto" value="0" checked/><i></i>否</label>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">红包分类</div>
          <div class="col-sm-10">
            <select name="gift_cate" class="form-control">
              <option value="0">使用全部可用</option>
              @foreach($cates as $item)
              <option value="{{$item->code}}">{{$item->name}}</option>
              @endforeach 
            </select>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="disable-input">
          <div class="form-group">
            <div class="col-sm-2 control-label">融资期限*</div>
            <div class="col-sm-2">
              <label class="checkbox-inline i-checks"><input type="radio" name="finance_time_cate" value="m" checked><i></i>定制月份</label>
            </div>
            <div class="col-sm-8">
              <select name="finance_time_num" class="form-control" data-rule-required="true">
                <option value="">请选择月份</option>
                @for($i=1;$i<25;$i++)
                <option value="{{ $i }}" selected>{{$i}}个月</option>
                @endfor
              </select>
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-2 col-sm-offset-2">
              <label class="checkbox-inline i-checks"><input type="radio" name="finance_time_cate" value="d"><i></i>定制天数</label>
            </div>
            <div class="col-sm-8"><input type="text" class="form-control" name="finance_time_num" data-rule-number="true" disabled data-rule-required="true" placeholder="输入天数360"/></div>
          </div>
          <div class="form-group">
            <div class="col-sm-2 col-sm-offset-2">
              <label class="checkbox-inline i-checks"><input type="radio" name="finance_time_cate" value="mm"><i></i>自然月份</label>
            </div>
            <div class="col-sm-8">
              <select name="finance_time_num" class="form-control" data-rule-required="true" disabled>
                <option value="">请选择月份</option>
                @for($i=1;$i<25;$i++)
                <option value="{{$i}}">{{$i}}个月</option>
                @endfor
              </select>
            </div>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="disable-input">
          <div class="form-group">
            <div class="col-sm-2 control-label">满标条件*</div>
            <div class="col-sm-2">
              <label class="checkbox-inline i-checks"><input type="radio" name="full_code" value="pc" checked/><i></i>固定比例</label>
            </div>
            <div class="col-sm-8">
              <div class="input-group">
                <input type="text" class="form-control" name="full_num" data-rule-number="true" data-rule-required="true" value="5"/>
                <span class="input-group-addon">%</span>
              </div>
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-2 col-sm-offset-2">
              <label class="checkbox-inline i-checks"><input type="radio" name="full_code" value="time"/><i></i>固定时间</label>
            </div>
            <div class="col-sm-8"><input type="text" class="form-control datetimepicker" name="full_num" disabled data-rule-required="true"/></div>
          </div>
          <div class="form-group">
            <div class="col-sm-2 col-sm-offset-2">
              <label class="checkbox-inline i-checks"><input type="radio" name="full_code" value="money"/><i></i>固定金额</label>
            </div>
            <div class="col-sm-8"><input type="text" class="form-control" name="full_num" disabled data-rule-required="true"/></div>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">起投金额*</div>
          <div class="col-sm-4">
            <input type="text" class="form-control" name="finance_rule_money" value="100" data-rule-required="true" data-rule-number="true"/>
          </div>
          <div class="col-sm-6">
            <label class="checkbox i-checks"><input type="checkbox" name="finance_rule_fold" value="1"/><i></i>是否为起投金额的倍数</label>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">投资时间*</label>
          <div class="col-lg-5">
            <input type="text" class="form-control datetimepicker" name="start_time" value="{{ date('Y-m-d H:i:s') }}" data-rule-required="true"/> 
          </div>
          <div class="col-lg-5">
            <input type="text" class="form-control datetimepicker" name="end_time" value="{{ date('Y-m-d H:i:s',strtotime('+7 day')) }}" data-rule-required="true"/> 
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">项目类型</div>
          <div class="col-sm-10">
            <p class="form-control-static">{{$type->name}}</p>
          </div>
        </div>
        @foreach($type_attrs as $key=>$item)
        <div class="form-group">
          <label class="col-lg-2 control-label">{{$item->name}}</label>
          <div class="col-sm-10">
            @if($item->template_attribute==0)
            <textarea name="attr[{{$item->id}}][]" rows="5" class="editor" id="{{'editor'.$key}}">{{$item->content}}</textarea>
            @elseif($item->template_attribute==1)
            <input type="file" class="form-control" name="attr[{{$item->id}}][]" multiple data-fileinput-image/>
            @endif
          </div>
        </div>
        @endforeach
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">分润信息*</div>
          <div class="col-sm-10">
            <select name="profits_cate" class="form-control select2" data-url="{{ admin_action('Business\DemandController@getProfitRoles') }}" data-rule-required="true">
              <option value="">请选择分润模板</option>
              @foreach($profits as $item)
              <option value="{{$item->id}}">{{$item->name}}</option>
              @endforeach 
            </select>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">收益展示</label>
          <div class="col-sm-5" id="profits_stage_one">
          </div>
          <div class="col-sm-5" id="profits_stage_two">
          </div>
          <p class="col-sm-offset-2 col-sm-12 form-control-static">
            <input type="hidden" name="rate"/>
            融资成本利率：<span class="text-danger" id="scale-total">0</span>%
          </p>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">收益展示*</label>
          <div class="col-sm-10">
            <input type="text" class="form-control" name="auto_rate" data-rule-required="true"/>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">担保合同*</div>
          <div class="col-sm-10">
            <select name="collateral_tmp" class="form-control select2" data-rule-required="true">
              <option value="">请选择担保合同</option>
              @foreach($agreement as $item)
              <option value="{{$item->id}}" selected>{{$item->title}}</option>
              @endforeach 
            </select>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">三方机构</div>
          <div class="col-sm-10">
            <select name="collateral_id" class="form-control select2">
              <option value="">请选择担保方式</option>
              @foreach($collateral_roles as $item)
              <option value="{{$item->id}}" selected>{{$item->username}}</option>
              @endforeach 
            </select>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">三方机构类型*</div>
          <div class="col-sm-10">
            <select name="collateral_type" class="form-control" data-rule-required="true">
              <option value="">三方机构类型</option>
              @foreach($collateral_types as $item)
              <option value="{{$item->code}}">{{$item->name}}</option>
              @endforeach 
            </select>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">担保合同号</div>
          <div class="col-sm-10">
            <input type="text" class="form-control" name="collateral_licence_no" value="{{createSn()}}"/>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-sm-2 control-label">担保方式</div>
          <div class="col-sm-10">
            <select name="collateral" class="form-control select2">
              <option value="">请选择担保方式</option>
              @foreach($promise as $item)
              <option value="{{$item->code}}" {{'promise_type_1'==$item->code?'selected':''}}>{{$item->name}}</option>
              @endforeach 
            </select>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-lg-4 col-lg-offset-2">
            <a href="{{ admin_action('Business\DemandController@index') }}" class="btn btn-default">返&nbsp;回</a>
            <input type="submit" class="btn btn-info" name="stop" value="暂存"/>
            <input type="submit" class="btn btn-primary" name="none" value="提交审核"/>
          </div>
        </div>
      </form>
    </div>
  </div>
@endsection
@section('scripts')
<script src="{{ asset('resources/admin/plugins/ueditor/ueditor.config.js') }}"></script>
<script src="{{ asset('resources/admin/plugins/ueditor/ueditor.all.min.js') }}"></script>
<script src="{{ asset('resources/admin/js/project.js') }}"></script>
@endsection